<?php
/**
 * This class provide authorization api for user.
 * + Can be extended to user
 * + For far future support OAUTH2/OAUTH WRAP with permission of doing as user.
 * @package     nuo
 * @subpackage  nuo.user
 * @author      Nam Nguyen <nam.ngvan@gmail.com>
 * @version     1.0
 * @since       Apr 18, 2013
 */
interface Nuo_Acl_Interface
{

	/**
	 * Get permission id
	 * @access  public
	 * @return  int
	 */
	function getId();

	/**
	 * Set new permission value associate with action
	 * WARNING:
	 * + Do not store this value to database
	 * + To store new value, use permission api instead
	 * @access  public
	 * @param   string  $action
	 * @param   mixed   $value
	 * @return  Nuo_Permission
	 */
	function setAllow($action, $value);

	/**
	 * Get permission of this action
	 * @access public  int
	 * @param  string  $action
	 * @return mixed
	 */
	function allow($action);

	/**
	 * Required user to allow to action.
	 * + If user has authorized to do "action", return true
	 * + If user has no permission to pass "action", redirect user to login required
	 * or permission deined page.
	 * + If you want to get permission instead of required user, please use
	 * ":allow()" instead of this method.
	 * @access  public
	 * @param   string   $action
	 * @param   int      $def
	 * @return  void
	 */
	function required($action);
}
